package top.hekun.study;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import top.hekun.study.controller.TestController;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * @Author: 贺坤
 * @Date: 2023/7/5 9:29
 */
@SpringBootApplication
public class TextMain {
    public static void main(String[] args) throws ClassNotFoundException {
        ConfigurableApplicationContext application= SpringApplication.run(TextMain.class, args);

    }

    private void test() throws ClassNotFoundException {
        Class<?> loadClass0 =  new TextMain().getClass().getClassLoader().loadClass("top.hekun.study.annotate.ITest");
        Method[] methods0 = loadClass0.getMethods();
        Method method0 = methods0[0];
        Annotation[] declaredAnnotations0 = method0.getDeclaredAnnotations();
        System.out.println(Arrays.toString(declaredAnnotations0));

        System.out.println("************");

        Class<?> loadClass =  new TestController().getClass();
        Method[] methods = loadClass.getMethods();
        Method method = methods[0];
        System.out.println(method.getName());
        Annotation[] declaredAnnotations = method.getDeclaredAnnotations();
        System.out.println(Arrays.toString(declaredAnnotations));
    }

}
